/**
 * 
 */
// var encrypt=require('encryptjs.js');
var PlayerPerfers = cc.Class({
    statics: {
        instance: null
    },
    extends: cc.Component,

    properties: {
        
    },

    onLoad () {
        
    },

    start () {
        
    },

    // update (dt) {},
    //clear
    clear(){
        cc.sys.localStorage.clear();
    },
    //save
    setItem(key, value, encrypt){
        if(encrypt && encrypt == true){
            
        }
        
        cc.sys.localStorage.setItem(key, value);
    },
    //read
    getItem(key, encrypt){
        if(encrypt && encrypt == true){
            
        }
        return cc.sys.localStorage.getItem(key);
    },
    getInt(key, encrypt){
        var res = this.getItem(key, encrypt);
        if(!res){
            return 0;
        }
        return parseInt(res);
    },
    hasItem(key){
        let res = cc.sys.localStorage.getItem(key);
        if(res){
            return true;
        }
        return false;
    },
    save(){
        cc.sys.localStorage.save();
    },

});

PlayerPerfers.instance = new PlayerPerfers();
module.exports = PlayerPerfers;